package com.firmye.codereposboot.utils;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

public class HttpUtil {

    public static String doGet(String str) throws Exception {
        URL url = new URL(str);
        URLConnection connection = url.openConnection();
        connection.connect();
        InputStream stream = connection.getInputStream();
        InputStreamReader reader = new InputStreamReader(stream);
        BufferedReader br = new BufferedReader(reader);
        String result = "";
        for (String line = null; (line = br.readLine()) != null;) {
            result += line;
        }
        if (br != null)
            br.close();
        if (reader != null)
            reader.close();
        if (null != stream)
            stream.close();
        return result;
    }

}
